package com.itheima.search.init;

import com.itheima.search.constant.MqConstants;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class SearchInit {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    /**
     * 初始化搜索系统
     */
    @PostConstruct
    public void init() {
        rabbitTemplate.convertAndSend(MqConstants.NEWS_INIT_EXCHANGE, MqConstants.NEWS_INIT_ROUTING_KEY, "start init");
    }
}
